<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>list</title>
<#include "/admin/include/head.htm">
<script type="text/javascript">
    var grid;
	
    $(function () {
        grid = $("#maingrid").ligerGrid({
            columns: [
			{name: 'id', hide: true, width:0, isAllowHide: false},
			{display: '登录帐号', name: 'username', align: 'center', width: 100 },
			{display: '昵称', name: 'name', align: 'center', width: 150 },
            {display: '性别', name: 'sex', align: 'center', width: 100,
            	render:function(row){
            		if(row.sex == 'true'){
            			return '男';
            		}
            		return '女';
            	}
            },
            {display: '电子邮箱', name: 'email', align: 'center', width: 150 },
            {display: '手机号码', name: 'mobile', align: 'center', width: 100 },
            {display: '积分', name: 'point', align: 'center', width: 100 },
            {display: '余额', name: 'deposit', align: 'center', width: 100 },
            {display: '是否可用', name: 'isAccountEnabled', align: 'center', width: 100,dict:"common" }],  
            pageSize:20, url: '${base}/admin/b2c/member/queryData.jhtml',
			toolbar: {}, width: '100%', height:'100%', enabledSort: true
        });
        $("#pageloading").hide();
		LG.loadToolbar(grid);
		
		//绑定搜索按钮
		LG.search(grid);
    });
    
    function add(){
    	top.f_addTab(null, '新增会员', base + '/admin/b2c/member/add.jhtml');
    }
    
    function edit(){
    	var selecteds = grid.getSelecteds();
		if (selecteds.length > 1) { 
			LG.tip('请选择一个会员!'); 
			return; 
		}
		var id = selecteds[0].id;
		if(top.f_isTabItemExist("member" + id)){
			top.f_switchTab("member" + id);
		}else{
			top.f_addTab("member" + id, '会员修改['+selecteds[0].username+']', base + '/admin/b2c/member/edit/' + id + '.jhtml');
	  	}
    }
    
	function f_enable() {
		var selecteds = grid.getSelecteds();
      	if (selecteds.length > 0) {
	      	jQuery.ligerDialog.confirm('确定启用吗?', function (confirm) {
				if (confirm){
					LG.ajax({
		              	url: base + '/admin/b2c/member/enable.jhtml',
		              	loading: '正在启用中...',
		              	data: { ids: LG.getIds(selecteds) },
		              	success: function () {
		                  	LG.showSuccess('启用成功');
		                  	f_reload();
		              	},
		              	error: function (message) {
		                  	LG.showError(message);
		              	}
		          	});
				}
			});
      	} else {
          	LG.tip('请选择行!');
      	}
  	}
    
	function f_disable() {
		var selecteds = grid.getSelecteds();
      	if (selecteds.length > 0) {
	      	jQuery.ligerDialog.confirm('确定禁用吗?', function (confirm) {
				if (confirm){
					LG.ajax({
		              	url: base + '/admin/b2c/member/disable.jhtml',
		              	loading: '正在禁用中...',
		              	data: { ids: LG.getIds(selecteds) },
		              	success: function () {
		                  	LG.showSuccess('禁用成功');
		                  	f_reload();
		              	},
		              	error: function (message) {
		                  	LG.showError(message);
		              	}
		          	});
				}
			});
      	} else {
          	LG.tip('请选择行!');
      	}
  	}
    
</script>
</head>
<body style="padding:10px; overflow:hidden;">
	<div id="functions">
		<div class="clearfix">
			<div>
				<span>
					登录帐号:<input type="text" class="formText" name="search_LIKE_username"/>
				</span>
				<span>
					昵称:<input type="text" class="formText" name="search_LIKE_name"/>
				</span>
				<span>
					电子邮箱:<input type="text" class="formText" name="search_EQ_email"/>
				</span>
				<span>
					手机号码:<input type="text" class="formText" name="search_EQ_mobile"/>
				</span>
				<input type="button" id="search" class="button" value="搜索"/>
				<a href="#" id="search_btn_reset" face="Wingdings 3">解除搜索,显示全部数据</a>
			</div>
		</div>
	</div>
	<div id="maingrid" style="margin:0; padding:0"></div>
</body>
</html>